<html>
<head>
<title>Object tag's locations updated after redirect</title>
<script type="text/javascript" src="/shared/scripts/testcase.js"></script>
<script type="text/javascript" src="/shared/scripts/misc.js"></script>
<script type="text/javascript">
if (window.addEventListener) {
	window.addEventListener('load', f, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', f);
} else {
	window.onload = f;
}

function insert_elements(xhr, tc) {
	//var insert_head = document.getElementsByTagName('head')[0];
	var insert_body = document.getElementById('id1');
	var redirect = "/redirect?loc=http://victim.com/shared/resources/";
	
	
	// object element (archive attrib)
	var objectt_a = new tElement("object", "objtest_archive");
	objectt_a.orig_loc = redirect+"data.dat";
	var object_attribs = new Array("id", objectt_a.dom_id,
								   "archive", objectt_a.orig_loc,
								   "data", "/shared/resources/data.html",
								   "type", "text/html");
								   
	objectt_a.loc_attrib = "archive";
	objectt_a.dom_loc = insert_body;
	objectt_a.insertAttributes(object_attribs);
	objectt_a.insertToDOM();
	
	// object element (codebase attrib)
	var objectt_c = new tElement("object", "objtest_codebase");
	objectt_c.orig_loc = redirect+"codebase.html";
	var object_attribs = new Array("id", objectt_c.dom_id,
								   "codebase", objectt_c.orig_loc,
								   "data", "/shared/resources/data.html",
								   "type", "text/html");
	objectt_c.loc_attrib = "codebase";
	objectt_c.dom_loc = insert_body;
	objectt_c.insertAttributes(object_attribs);
	objectt_c.insertToDOM();
	
	// object element (data attrib)
	var objectt_d = new tElement("object", "objtest_data");
	objectt_d.orig_loc = redirect+"data.html";
	var object_attribs = new Array("id", objectt_d.dom_id,
								   "data", objectt_d.orig_loc,
								   "type", "text/html");
	objectt_d.loc_attrib = "data";
	objectt_d.dom_loc = insert_body;
	objectt_d.insertAttributes(object_attribs);
	objectt_d.insertToDOM();
	
	// object element (usemap attrib)
	var objectt_u = new tElement("object", "objtest_usemap");
	objectt_u.orig_loc = redirect+"data.html";
	var object_attribs = new Array("id", objectt_u.dom_id,
								   "usemap", objectt_u.orig_loc,
								   "data", "/shared/resources/4x4.png",
								   "type", "text/html");
	objectt_u.loc_attrib = "usemap";
	objectt_u.dom_loc = insert_body;
	objectt_u.insertAttributes(object_attribs);
	objectt_u.insertToDOM();
	
	var tobjs = new Array(objectt_a, objectt_c, objectt_d, objectt_u);
						 
	// give enough time for the objects/elements to load... (see misc.js)
	setTimeout( (function() { get_loc_results_cb(tc, tobjs); }), 5000);
}

function f() {
	var tc = new TestCase();
	tc.input = 'object\'s archive,codebase,data and usemap attributes';
	tc.description = 'Test if Object tag\'s locations (archive/codebase/data etc) have been updated after a redirect';
	tc.expected_result = 'not updated';
	tc.test_passed = 'true';
	tc.savePreTest(insert_elements);
}

</script>
</head>
<body>
<div id="id1"></div>
</body>
</html>